Method of encoding an image and device implementing said method

ABSTRACT

The invention relates to a method of encoding an image divided into non-overlapping macroblocks themselves divided into non-overlapping blocks of N by N pixels into a binary stream. It comprises the steps of: —transforming each of the block into a transformed block of coefficients comprising one low frequency coefficient and N2-1 coefficients, called high frequency coefficients, of higher frequencies than the low frequency; —quantizing each coefficient of each of the transformed blocks with a quantizing parameter; —encoding the quantized coefficients into a binary stream. According to the invention, the low frequency coefficients of the transformed blocks are quantized with a same quantizing parameter, called first quantizing parameter.

This application claims the benefit, under 35 U.S.C. §365 of International Application PCT/CN2006/003359, filed Dec. 11, 2006, which was published in accordance with PCT Article 21(2) on Jun. 19, 2008 in English.

1. FIELD OF THE INVENTION

The invention relates to a method of encoding an image. More precisely it concerns a method of quantizing said image. The invention also relates to an encoding device implementing said method.

2. BACKGROUND OF THE INVENTION

In order to encode an image, it is often necessary to reduce spatial redundancies. To this aim, in typical image coding methods, the image is divided into non-overlapping blocks of N×N pixels and each block is then transformed into a transformed block of coefficients. These coding methods decorrelate the image pixels so that the redundancy can be reduced more efficiently in the transform domain. In this respect, the energy compaction property of the transform is important. Among the various transforms commonly used, the Discrete Cosine Transform (DCT) is widely used for its superior energy compaction property. The transformed block represents a set of coefficients with increasing spatial frequencies. The coefficient in the top left (0,0) position of the transformed block is known as the DC coefficient, and it represents the average value of the N×N block. The other (N²-1) coefficients are known as AC coefficients, and they represent the high-frequency details. The dimension N×N can be 16×16, 8×8 or 4×4 according to different applications. In order to reduce the number of bits required to encode the image, typical image coding methods quantize the coefficients of the transformed blocks with a quantizing step. Quantization is the process of reducing the number of possible values of a quantity, thereby reducing the number of bits needed to represent it. The choice of the quantizing step is decisive to insure a high quality of the decoded image.

3. SUMMARY OF THE INVENTION

The invention aims at providing a solution for the quantization of an image.

To this aim, the invention relates to a method of encoding an image divided into non-overlapping macroblocks themselves divided into non-overlapping blocks of N by N pixels into a binary stream. It comprises the steps of:

transforming each of the block into a transformed block of coefficients comprising one low frequency coefficient and N²-1 coefficients, called high frequency coefficients, of higher frequencies than the low frequency;

quantizing each coefficient of each of the transformed blocks with a quantizing parameter;

encoding the quantized coefficients into a binary stream.

According to the invention, the low frequency coefficients of the transformed blocks are quantized with a same quantizing parameter, called first quantizing parameter. This advantageously makes it possible to ensure a continuous basic quality on the whole image

Advantageously, the high frequency coefficients of a same macroblock are quantized with a same quantizing parameter, called second quantizing parameter.

Preferentially, the second quantizing parameter is computed as the sum of the first quantizing parameter and of an increment, the increment being determined based on a visual perceptual interest value computed for the macroblock.

According to a first aspect of the invention, the visual perceptual interest value depends on the average luminance value of the macroblock.

According to a variant, the visual perceptual interest value also depends on the variance of each block of the macroblock.

According to another variant, the visual perceptual interest value also depends on the chrominance information of the macroblock.

The invention further relates to a device for encoding an image divided into non-overlapping macroblocks themselves divided into non-overlapping blocks of N by N pixels into a binary stream. This device comprises:

transform means for transforming each of the block into a transformed block of coefficients comprising one low frequency coefficient and N²-1 coefficients, called high frequency coefficients, of higher frequencies than the low frequency;

quantizing means for quantizing each coefficient of each of the transformed blocks with a quantizing parameter;

encoding means for encoding the quantized coefficients into a binary stream.

According to the invention, the quantizing means quantize the low frequency coefficients of the transformed blocks with a same quantizing parameter, called first quantizing parameter.

According to an aspect of the invention the transform means are a DCT transform unit.

4. BRIEF DESCRIPTION OF THE DRAWINGS

Other features and advantages of the invention will appear with the following description of some of its embodiments, this description being made in connection with the drawings in which:

FIG. 1 depicts a flowchart of the method according to a first embodiment of the invention;

FIG. 2 depicts a detailed flowchart of the quantization step of the method according to a first embodiment of the invention;

FIG. 3 depicts a detailed flowchart of the features extraction step of the method according to a first embodiment of the invention;

FIG. 4 depicts, for regions within an image, the level of visual perceptual interest of these regions using different grey levels;

FIG. 5 depicts a flowchart of the method according to a second embodiment of the invention;

FIG. 6 depicts a coding device according to a first embodiment of the invention; and

FIG. 7 depicts a coding device according to a second embodiment of the invention.

5. DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

In FIGS. 1 to 3 and FIG. 5, the represented boxes are purely functional entities, which do not necessarily correspond to physical separated entities. Namely, they could be developed in the form of software, or be implemented in one or several integrated circuits. On these figures, the similar elements are referenced with the same numbers.

The invention relates to a method of encoding an image. The image is made up of pixels and divided into non-overlapping macroblocks M_(l) themselves divided into blocks b_(p,q) of pixels, where l is the index of the macroblock and (p,q) are the coordinates of the block, i.e. the block b_(p,q) is located in p^(th) column of blocks and in CO line of blocks. In many applications, a block b_(p,q) is a block of 8 pixels by 8 pixels and a macroblock is made up of 4 blocks b_(p,q). However, the invention is not limited to this case and may be used whatever the size of the blocks b_(p,q) and the size of the macroblocks MB_(l) are.

A first embodiment of the method is described with reference to FIGS. 1, 2 and 3. The method comprises a step 10 for transforming each block b_(p,q) of the image in a transformed block B_(p,q) of coefficients. If a block b_(p,q) is located in a macroblock M_(l), then the transformed block B_(p,q) is located in the corresponding transformed macroblock denoted MB_(l). Each block b_(p,q) is, for example, transformed in a transformed block B_(p,q) by a Discrete Cosine Transform (DCT) according to the following equation:

${{B_{p,q}\left( {u,v} \right)} = {\frac{4{Q(u)}{Q(v)}}{N^{2}}{\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{{b_{p,q}\left( {j,k} \right)} \cdot {\cos\left\lbrack \frac{\left( {{2j} + 1} \right)u\;\pi}{2N} \right\rbrack} \cdot {\cos\left\lbrack \frac{\left( {{2k} + 1} \right)v\;\pi}{2N} \right\rbrack}}}}}},$ where:

-   -   u, v=0, 1, . . . , N−1     -   b_(p,q)(j,k) is the luminance value (or chrominance value) of         the pixel of block b_(p,q) whose coordinates are (j,k);     -   B_(p,q)(u,v) is the value of the coefficient of transformed         block B_(p,q) whose coordinates are (u,v); and

${- {Q(w)}} = \left\{ \begin{matrix} {\frac{1}{\sqrt{2}},} & {{{if}\mspace{14mu} w} = 0} \\ {1,} & {{{{if}\mspace{14mu} w} = 1},2,\ldots\mspace{14mu},{N - 1}} \end{matrix} \right.$

At step 20 each coefficient B_(p,q)(u,v) of each transformed block B_(p,q) is quantized with a quantizing parameter QP_(p,q)(u,v) into a quantized coefficient B^(Q) _(p,q)(u,v). According to a first aspect of the invention, all DC coefficients in the image are quantized 210 with a same quantizing parameter QP_(f), i.e. ∀(p,q), QP_(p,q)(0,0)=QP_(f). This makes it possible to ensure a continuous basic quality on the whole image. This quantizing parameter QP_(f) is for example determined by a rate control method such as the well known TM5 rate control method described for MPEG2 in the document N0400 from ISO/IEC JTC1/SC29/WG11 entitled “Test Model 5” dated April 1993. According to another aspect of the invention, all the AC coefficients of all the blocks B_(p,q) located in the same macroblock MB_(l) are quantized 220 with a same quantizing parameter QP_(l) which may or may not be equal to QP_(f). According to a specific characteristic, the quantizing parameter used to quantize all these AC coefficients equals QP_(l)=QP_(f)+ΔQP_(l), where ΔQP_(l) is determined on the basis of the perceptual interest of the macroblock MB_(l). In this case, for all the AC coefficients in MB_(l), QP_(p,q)(u,v)=QP_(l)=Qp_(f)+ΔQP_(l). According to the first embodiment, ΔQP_(l)=−W_(l)·QP_(step) where QP_(step) set for example to 2. The weight W_(l) is computed 30 by combining 340 three different features F_(l) ¹, F_(l) ^(2′) and F_(l) ³ computed from the macroblock M_(l) at steps 310, 320 and 330 respectively. The first feature associated to each macroblock M_(l) in the image takes its value in the set {0,1}. If F_(p,q) ¹=1 then the macroblock M_(l) belongs to a skin region, e.g. a human face otherwise, i.e. F_(l) ¹=0, the block does not belong to a skin region. To compute 310 this feature it is required to detect the skin tones. To this aim, the skin region in the image, if any may be detected using a method of color segmentation such as the one proposed by D. Cai and K. N. Ngan in the document entitled “Face segmentation using skin color map in videophone applications” published in IEEE transactions on CSVT in 1999. This feature will make it possible to quantized more finely skin regions which are important to human eyes from a visual quality point of view. The second feature F_(l) ² associated to each macroblock M, in the image takes its value in the set {0,1}. If F_(l) ²=1 then the macroblock M, is a flat region otherwise it is not. To this aim, the variance v_(k) of each block b_(p,q) located in macroblock M_(l) is used to compute the value act, as follows: act_(l)=1+min(v ₁ ,v ₂ , . . . ,v _(k)) where v_(k) is the variance of the k^(th) block located in the macroblock M_(l). If act_(l) is smaller than a predefined threshold THT, the macroblock M_(l) is a flat region, i.e. F_(l) ²=1, otherwise F_(l) ²=0. THT can be set to 8 in most applications. This feature makes it possible to quantize more finely the flat regions, ie. low detailed regions. Indeed, visual defects in such flat regions are more annoying for human eyes. The third feature F_(l) ³ associated to each macroblock M_(l) in the image takes its value in the set {0,1}. To compute 330 the value F_(l) ³, the average luminance level over the macroblock M_(l) is compared to two thresholds THL and THH which can be set to 23 and 1952 respectively. A value named level is then derived as follows:

${level} = \left\{ \begin{matrix} {0,} & {{{if}\mspace{14mu} 0} \leq {luma} < {THL}} \\ {1,} & {{{if}\mspace{14mu} T\; H\; L} \leq {luma} \leq {THH}} \\ {2,} & {{{if}\mspace{14mu} T\; H\; H} < {luma} \leq 255} \end{matrix} \right.$ F_(l) ³=0 if level=0 or 2, and F_(l) ³=1 if level=1. This feature makes it possible to quantize more finely mid-tones regions to which human eyes is more sensitive from a visual quality point of view. The three features are combined 340 as follows in the weight W_(l):

$W_{l} = \left\{ \begin{matrix} {3,} & {{macroblock}\mspace{14mu} M_{1}\mspace{14mu}{has}\mspace{14mu} 3\mspace{14mu}{features}\mspace{14mu}{that}\mspace{14mu}{equal}\mspace{14mu} 1} \\ {2,} & {{macroblock}\mspace{14mu} M_{1}\mspace{14mu}{has}\mspace{14mu}{only}\mspace{14mu} 2\mspace{14mu}{features}\mspace{14mu}{that}\mspace{14mu}{equal}\mspace{14mu} 1} \\ {1,} & {{macroblock}\mspace{14mu} M_{1}\mspace{14mu}{has}\mspace{14mu}{only}\mspace{14mu} 1\mspace{14mu}{feature}\mspace{14mu}{that}\mspace{14mu}{equal}\mspace{14mu} 1} \\ {{- 2},} & {{macroblock}\mspace{14mu} M_{1}\mspace{14mu}{has}\mspace{14mu}{no}\mspace{14mu}{feature}\mspace{14mu}{that}\mspace{14mu}{equal}\mspace{14mu} 1} \end{matrix} \right.$ This is illustrated by FIG. 4.

The quantized coefficients are then encoded at step 40, for example by a classical entropy coding method such as the one described at section 7.9 in a document from ISO/IEC 14496-10 entitled <<Information technology—Coding of audio-visual objects—Part 10: Advanced Video Coding>>.

A first embodiment of the method is described with reference to FIGS. 2 and 5. The method comprises a step 10 for transforming each block b_(p,q) of the image in a transformed block B_(p,q) of coefficients. If a block b_(p,q) is located in a macroblock M_(l), then the transformed block B_(p,q) is located in the corresponding transformed macroblock denoted MB_(l). Each block b_(p,q) is, for example, transformed in a transformed block B_(p,q) by a Discrete Cosine Transform (DCT) according to the following equation:

${{B_{p,q}\left( {u,v} \right)} = {\frac{4{Q(u)}{Q(v)}}{N^{2}}{\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{{b_{p,q}\left( {j,k} \right)} \cdot {\cos\left\lbrack \frac{\left( {{2j} + 1} \right)u\;\pi}{2N} \right\rbrack} \cdot {\cos\left\lbrack \frac{\left( {{2k} + 1} \right)v\;\pi}{2N} \right\rbrack}}}}}},$ where:

-   -   u, v=0, 1, . . . , N−1     -   b_(p,q)(j,k) is the luminance value (or chrominance value) of         the pixel of block b_(p,q) whose coordinates are (j,k);     -   B_(p,q)(u,v) is the value of the coefficient of transformed         block B_(p,q) whose coordinates are (u,v); and

${- {Q(w)}} = \left\{ \begin{matrix} {\frac{1}{\sqrt{2}},} & {{{if}\mspace{14mu} w} = 0} \\ {1,} & {{{{if}\mspace{14mu} w} = 1},2,\ldots\mspace{14mu},{N - 1}} \end{matrix} \right.$

At step 20 each coefficient B_(p,q)(u,v) of each transformed block B_(p,q) is quantized with a quantizing parameter QP_(p,q)(u,v) in a quantized coefficient B^(Q) _(p,q)(u,v). According to a first aspect of the invention, all DC coefficients in the image are quantized 210 with a same quantizing parameter QP_(f), i.e. ∀(p,q), QP_(p,q)(0,0)=QP_(f). This makes it possible to ensure a continuous basic quality on the whole image. This quantizing parameter QP_(f) is for example determined by a rate control method such as the well known TM5 rate control method described for MPEG2 in the document N0400 from ISO/IEC JTC1/SC29/WG11 entitled “Test Model 5” dated April 1993. According to another aspect of the invention, all the AC coefficients of all the blocks B_(p,q) located in the same macroblock MB_(l) are quantized 220 with a same quantizing parameter QP_(l) which may or may not be equal to QP_(f). According to a specific characteristic, the quantizing parameter used to quantize all these AC coefficients equals QP_(l)=QP_(f)+ΔQP_(l), where ΔQP_(l) is determined on the basis of the perceptual interest of the macroblock MB_(l). In this case, for all the AC coefficients in MB_(l), QP_(p,q)(u,v)=QP_(l)=QP_(f)+ΔQP_(l). According to the second embodiment,

${{\Delta\;{QP}_{1}} = {\frac{V_{1} - 128}{128} \cdot {QP}_{step}^{\prime}}},$ where V_(l) is the importance level V_(l) of the macroblock M_(l). In this case QP′_(step) may be set to 6. V_(l) is computed at step 31 from the macroblock M_(l) and is clipped so that it lies in the range [0-255]. To this aim the information map described by N. Bruce in the document entitled “Image analysis through local information measure” published in the Proceeding of the 17^(th) International Conference on Pattern Recognition, pp. 616-619, August 2004 is computed 31 for the whole image. This map assigns an importance level V_(l) to each macroblock M_(l). This method makes it possible to identify the perceptually important regions in the image by analyzing the properties of local image statistics in a classic information theoretic setting. Therefore it enables for adjusting the quantization parameter more continuously and thereby improves the visual quality of the decoded image.

The quantized coefficients are then encoded at step 40, for example by a classical entropy coding method such as the one described at section 7.9 in a document from ISO/IEC 14496-10 entitled <<Information technology—Coding of audio-visual objects—Part 10: Advanced Video Coding>>.

This solution makes it possible to get a smoothly distributed perceptual quality improvement with little change on the overall bitrate.

The invention also relates to a coding device CODEC depicted on FIGS. 6 and 7. On these figures, the similar elements are referenced with the same numbers. The device CODEC comprises a module T for transforming each block b_(p,q) of the image in a transformed block B_(p,q) of coefficients. It implements for example a DCT. The module T is linked to a module Q adapted for quantizing each coefficient B_(p,q)(u,v) of each transformed block B_(p,q) in a quantized coefficient B^(Q) _(p,q)(u,v). The module Q implements the step 20 of method described above. Therefore, the device CODEC comprises a module ROI₁ linked to the module Q and adapted to compute a weight W_(l) for each macroblock M_(l) of the image for example by implementing the steps 310 to 340 of the method described above. According to another characteristic depicted on FIG. 7, the module ROI₁ in the device CODEC is replaced by a module ROI₂ adapted to compute an importance level V_(l) for each macroblock M_(l) of the image for example by implementing the method described in the document entitled “Image analysis through local information measure” published in the Proceeding of the 17^(th) International Conference on Pattern Recognition, pp. 616-619, August 2004. The module Q is further linked to a module COD adapted for encoding the quantized coefficients B^(Q) _(p,q)(u,v). It is preferentially an entropy coder.

The invention described for an image may be advantageously applied to a video, more precisely to each image of the video. 

The invention claimed is:
 1. Method of encoding an image divided into non-overlapping macroblocks themselves divided into non-overlapping blocks of N by N pixels into a binary stream comprising the steps of: transforming each of said block into a transformed block of coefficients comprising one low frequency coefficient and N²-1 coefficients, called high frequency coefficients, of higher frequencies than said low frequency; quantizing each coefficient of each of said transformed blocks with a quantizing parameter; encoding said quantized coefficients into a binary stream; wherein the low frequency coefficients of said transformed blocks are quantized with a same first quantizing parameter and the high frequency coefficients of a same macroblock are quantized with a same second quantizing parameter wherein said second quantizing parameter is computed as the sum of said first quantizing parameter and of an increment, wherein said increment depends on whether the macroblock belongs to a skin region, to a flat region and further depends on a level of average luminance of said macroblock.
 2. Device for encoding an image divided into non-overlapping macroblocks themselves divided into non-overlapping blocks of N by N pixels into a binary stream comprising: transform means for transforming each of said block into a transformed block of coefficients comprising one low frequency coefficient and N²-1 coefficients, called high frequency coefficients, of higher frequencies than said low frequency; quantizing means for quantizing each coefficient of each of said transformed blocks with a quantizing parameter; encoding means for encoding said quantized coefficients into a binary stream; wherein said quantizing means quantize the low frequency coefficients of said transformed blocks with a same quantizing parameter and the high frequency coefficients of a same macroblock are quantized with a same second quantizing parameter wherein said second quantizing parameter is computer as the sum of said first quantizing parameter and of an increment, wherein said increment depends on whether the macroblock belongs to a skin region, to a flat region and further depends on a level of average luminance of said macroblock.
 3. Device according to claim 2, wherein said transform means are a DCT transform unit.
 4. Method according to claim 1, wherein said macroblock being divided into k blocks is flat when 1+min(v1, v2, . . . , vk) is smaller than a first threshold value, where vk is a variance of the k^(th) block of said macroblock.
 5. Method according to claim 4, wherein said level of average luminance of said macroblock equals 0 when average luminance of said macroblock is between zero and a second threshold value, equals 1 when average luminance of said macroblock is between said second threshold value and a third threshold value and equals 2 when average luminance of said macroblock is between said third threshold value and
 255. 6. Method according to claim 5, wherein said increment equals (−W_(l)·OP_(step)), where QP_(step) is a quantizing parameter and where W_(l) equals 3 when the three following conditions are true: the macroblock belongs to a skin region, to a flat region and said level of average luminance equals 1; W_(l) equals 2 when only two of said conditions are true; W_(l) equals 1 when only one of said conditions is true; W_(l) equals −2 when none of the conditions is true.
 7. Method according to claim 6, wherein QP_(step)=2.
 8. Device according to claim 2, wherein said macroblock is flat when 1+min(v1, v2, . . . , vk) is smaller than a first threshold value, where, the macroblock being divided into k blocks, vk is a variance of the k^(th) block of said macroblock.
 9. Device according to claim 8, wherein said level of average luminance of said macroblock equals 0 when said average luminance of said macroblock is between zero and a second threshold value, equals 1 when said average luminance of said macroblock is between said second threshold value and a third threshold value and equals 2 when said average luminance of said macroblock is between said third threshold value and
 255. 10. Device according to claim 9, wherein said increment equals (−W_(l)·OP_(step)), where QP_(step) is a quantizing parameter and where W_(l) equals 3 when the three following conditions are true: the macroblock belongs to a skin region, to a flat region and said level of average luminance equals 1; W_(l) equals 2 when only two of said conditions are true; W_(l) equals 1 when only one of said conditions is true; W_(l) equals −2 when none of the conditions is true.
 11. Device according to claim 10, wherein QP_(step)=2. 